package com.dun.java.daoImpl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.din.java.dao.UserDao;
import com.dun.java.vo.User;

@Component
public class UserDaoImpl implements UserDao {

	private HibernateTemplate template;
	
	@Autowired
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.template = new HibernateTemplate(sessionFactory);
	}

	@Override
	public List<User> getUsers() {
		List<User> userList = template.find("from User");
		return userList;
	}
}
